package com.wed.db;

import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Scanner;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class insertPosiGVServlet
 */
@WebServlet("/insertPosiGVServlet")
public class insertPosiGVServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public insertPosiGVServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		
		
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		 int ass = Integer.parseInt(request.getParameter("AssignmentId"));
		 String concept = request.getParameter("Concept");
		 String user=request.getParameter("username");
		ConnectDB db=new ConnectDB();
		
		try
		{
			db.UpDateAssignment(ass);
		db.GhiFile(concept);
		db.insertPossiGV(ass);
		RequestDispatcher dispacher=request.getRequestDispatcher("CmapLecture.jsp");
    	dispacher.forward(request, response);
		
		}
		catch(Exception ex)
		{
			 response.sendRedirect("error.jsp");
		
		}
	}

}
